<?php
declare (strict_types = 1);

namespace app\command;

use think\facade\Cache;
use think\console\Command;
use think\console\Input;
use think\console\Output;

class Test extends Command
{
    protected function configure()
    {
        // 指令配置
        $this->setName('app\command\test')
            ->setDescription('the app\command\test command');
    }

    protected function execute(Input $input, Output $output)
    {
        // 指令输出

        Cache::set("a", "sbx");
        dump(Cache::get("a"));  //  sbx
        // 获取 Redis 实例
        $redis = Cache::store()->handler();
        // 测试 Redis 命令
        $redis->sadd('ab', 'b');
        $redis->sadd('ab', 'b');
        $redis->sadd('ab', 'c');
        dump($redis->smembers('ab')); // 输出: false

        $output->writeln('app\command\test');
    }
}
